package com.utbm.lo54.entity;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Session {

	private Long id;
	private Date startDate;
	private Date endDate;
	private String courseCode;
	private Long locationId;

	public Session() {}

	public Session(Date sd, Date ed) {
		startDate=sd;
		endDate=ed;
	}

	public Session(Long id, String courseCode, Long locationId, String startDate, String endDate) {
		this.id = id;
		this.courseCode = courseCode;
		this.locationId = locationId;
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		try{
			this.startDate =  format.parse(startDate);
			this.endDate = format.parse(endDate);
		}catch(Exception e){

		}
	}

	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Date getStartDate() {
		return startDate;
	}
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}
	public Date getEndDate() {
		return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getCourseCode() {
		return courseCode;
	}

	public void setCourseCode(String courseCode) {
		this.courseCode = courseCode;
	}

	public Long getLocationId() {
		return locationId;
	}

	public void setLocationId(Long locationId) {
		this.locationId = locationId;
	}

	@Override
	public String toString() {
		return "Session [id=" + id + ", startDate=" + startDate + ", endDate="
				+ endDate + ", courseId=" + courseCode + ", locationId="
				+ locationId + "]";
	}


}
